package com.yidu.verycd_background.service.impl;

import com.yidu.verycd_background.dao.VerycdTicketsUserDao;
import com.yidu.verycd_background.entity.VerycdTicketsUser;
import com.yidu.verycd_background.service.VerycdTicketsUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (VerycdTicketsUser)表服务实现类
 *
 * @author makejava
 * @since 2020-07-29 10:45:01
 */
@Service("verycdTicketsUserService")
public class VerycdTicketsUserServiceImpl implements VerycdTicketsUserService {
    @Resource
    private VerycdTicketsUserDao verycdTicketsUserDao;

    /**
     * 通过ID查询单条数据
     *
     * @param ticuserId 主键
     * @return 实例对象
     */
    @Override
    public VerycdTicketsUser queryById(Integer ticuserId) {
        return this.verycdTicketsUserDao.queryById(ticuserId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<VerycdTicketsUser> queryAllByLimit(int offset, int limit) {
        return this.verycdTicketsUserDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param verycdTicketsUser 实例对象
     * @return 实例对象
     */
    @Override
    public VerycdTicketsUser insert(VerycdTicketsUser verycdTicketsUser) {
        this.verycdTicketsUserDao.insert(verycdTicketsUser);
        return verycdTicketsUser;
    }

    /**
     * 修改数据
     *
     * @param verycdTicketsUser 实例对象
     * @return 实例对象
     */
    @Override
    public VerycdTicketsUser update(VerycdTicketsUser verycdTicketsUser) {
        this.verycdTicketsUserDao.update(verycdTicketsUser);
        return this.queryById(verycdTicketsUser.getTicuserId());
    }

    /**
     * 通过主键删除数据
     *
     * @param ticuserId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer ticuserId) {
        return this.verycdTicketsUserDao.deleteById(ticuserId) > 0;
    }
}